<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<style>
    @keyframes comein{
        0%{
            transform: translateX(-100px);
        }
        100%{
            transform: translateX(0px);
        }
    }
    /* 固定标签 */
    /* 进入 */
    .v-enter-active{
        animation: comein 1s;
    }

    @keyframes comeout
    {
        0%{
            transform: translateX(0px);
        }
        100%{
            transform: translateX(-100px);
        }
    }
    /* 固定标签 */
    /* 出去 */
    .v-leave-active{
        animation: comeout 1s;
    }
</style>
<body>
    <div id="app"></div>
</body>
<script>
    const app = Vue.createApp({
        data(){
            return{
                isshow: true
            }
        },
        methods:{
            guodu(){
                this.isshow = !this.isshow
            }
        },
        template:`
        <transition>
            <div v-show="isshow">出现和隐藏</div>
        </transition>
        <button @click="guodu()">按钮</button>`
    })
    app.mount("#app")
</script>
</html>